<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <!-- 引入bootstarp -->
    <script type="text/javascript" src="../js/bootstrap3/js/bootstrap.js"></script>
    <link rel="stylesheet" href="../js/bootstrap3/css/bootstrap.css">
    <!-- 引入bootstrap table的css、js -->
    <link type="text/css" rel="stylesheet" href="../js/bootstrap-table/bootstrap-table.css">
    <script type="text/javascript" src="../js/bootstrap-table/bootstrap-table.js"></script>
    <script type="text/javascript" src="../js/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <!-- 引入bootstrap datetime的css、js -->
    <link type="text/css" rel="stylesheet" href="../js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css">
    <script type="text/javascript" src="../js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="../js/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
</head>
<body>
<form class="form-inline">
    <div class="form-group">
        <label for="orderName">
            <font color="red">用户名</font>
        </label>
        <input type="text" class="form-control" id="orderName" placeholder="请输入用户名">
        <label for="startTime">
            <font color="red">时间</font>
        </label>
        <input type="text" class="date form-control" id="startTime" placeholder="请输入开始时间">
        <i class="glyphicon glyphicon-calendar"></i>
        <input type="text" class="date form-control" id="endTime" placeholder="请输入结束时间">
    </div>
    <button type="button" class="btn btn-primary glyphicon glyphicon-search" onclick="searchUser()">搜索</button>

</form>
<table class="table" id="orderTable"></table>
</body>
<script>
    $(function () {
        tables();
    })
    /**
     * 初始化页面加载所有用户信息
     */
    function tables(){
        $("#orderTable").bootstrapTable({
            url:'../zsl/findOrderList',
            type:'post',
            pagination:true, //开启分页
            //pageList:[1, 5, 10, 15,50],//分页组件
            pageNumber:1,
            pageSize:10,//默认每页条数
            sidePagination:'server',//分页方式：client客户端分页，server服务端分页
            striped:true,//条纹表格
            clickToSelect: true,
            queryParams:function(){
                return {
                    page:this.pageNumber,
                    rows:this.pageSize,
                    orderName:$("#orderName").val(),
                    startDate:$("#startTime").val(),
                    endDate:$("#endTime").val()
                };
            },
            columns:[
                {checkbox:true},
                {field:'id',title:'主键',width:80},
                {field:'orderNo',title:'订单编号',width:80},
                {field:'orderCreateTime',title:'创建时间',width:80},
                {field:'productName',title:'商品名称',width:80},
                {field:'productColor',title:'商品颜色',width:80},
                {field:'productImg',title:'商品图片',width:80,formatter:function(value,row,index){
                    return "<img src='"+value+"' width='50px' height='50px'/>";
                }},
                {field:'productPrice',title:'商品价格',width:80},
                {field:'storeName',title:'商家名称',width:80},
                {field:'userName',title:'购买用户',width:80}
            ],
        })
    }
    /*
        调查
    * */
    function searchUser() {
        $("#orderTable").bootstrapTable('refresh');
    }
    /**
     * 时间
     */
    $('.date').datetimepicker({
        language: 'zh-CN',//显示中文
        format: 'yyyy-mm-dd hh:ii:ss',//显示格式
        minView: "month",//设置只显示到月份
        initialDate: new Date(),//初始化当前日期
        autoclose: true,//选中自动关闭
        todayBtn: true//显示今日按钮
    });
</script>
</html>